package com.telsoft.kqxs;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.telsoft.adapter.ButtonAdapter;
import com.telsoft.adapter.ImageAdapter;
import com.telsoft.adapter.SettingAdapter;

public class MainActivity extends Activity {

	GridView gridView;
	GridView gridView2;
	String[] mainButtons;
	String[] mainBtns;
	String[] SpinnerProperties;
	@Override
	public void onCreate(Bundle savedInstanceState) {

		Resources res = getResources();
		mainButtons = res.getStringArray(R.array.btn_main);
		mainBtns = res.getStringArray(R.array.btn_main_1);
		SpinnerProperties = res.getStringArray(R.array.Category_array);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		gridView = (GridView) findViewById(R.id.gridView1);
		gridView2 = (GridView) findViewById(R.id.gridView2);
				
		gridView.setAdapter(new ImageAdapter(this, mainButtons));
		gridView2.setAdapter(new ButtonAdapter(this,mainBtns));

		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				if (position == 0) {
					startActivity(new Intent(MainActivity.this,
							ProvinceProperties.class));
				}
			}
		});
				
		gridView2.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				if (position == 1) {
					startActivity(new Intent(MainActivity.this,
							SettingAdapter.class));
				}
			}
		});
	}

}
